package com.kvest.testtask.datastorage;

import android.content.Context;
import android.content.SharedPreferences;

public class SettingsStorage 
{
	private static final String PREF_NAME = "settings";
	private static final String IS_XML_LOADED_PREF = "xml_loaded";
	
	private Context context;
	
	public SettingsStorage(Context context)
	{
		this.context = context;
	}
	
	public boolean isXMLLoaded()
	{
		SharedPreferences preferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
    	return preferences.getBoolean(IS_XML_LOADED_PREF, false);
	}
	
	public void setXMLLoaded(boolean value)
	{
		SharedPreferences preferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
    	SharedPreferences.Editor editor = preferences.edit();
    	try
    	{
    		editor.putBoolean(IS_XML_LOADED_PREF, value);
    	}
    	finally
    	{
    		editor.commit();
    	}
	}
}
